package com.moxiao.yfjh.module.blind.dal.mysql.mechanism;

import com.moxiao.yfjh.module.blind.controller.admin.mechanism.vo.MemberMechanismExportReqVO;
import com.moxiao.yfjh.module.blind.controller.admin.mechanism.vo.MemberMechanismPageReqVO;
import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.blind.dal.dataobject.mechanism.MemberMechanismDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.blind.controller.admin.mechanism.vo.*;

/**
 * 相亲会员等级机制 Mapper
 *
 * @author mx
 */
@Mapper
public interface MemberMechanismMapper extends BaseMapperX<MemberMechanismDO> {

    default PageResult<MemberMechanismDO> selectPage(MemberMechanismPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberMechanismDO>()
                .eqIfPresent(MemberMechanismDO::getLevelId, reqVO.getLevelId())
                .betweenIfPresent(MemberMechanismDO::getTime, reqVO.getTime())
                .eqIfPresent(MemberMechanismDO::getMoney, reqVO.getMoney())
                .eqIfPresent(MemberMechanismDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberMechanismDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberMechanismDO::getId));
    }

    default List<MemberMechanismDO> selectList(MemberMechanismExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MemberMechanismDO>()
                .eqIfPresent(MemberMechanismDO::getLevelId, reqVO.getLevelId())
                .betweenIfPresent(MemberMechanismDO::getTime, reqVO.getTime())
                .eqIfPresent(MemberMechanismDO::getMoney, reqVO.getMoney())
                .eqIfPresent(MemberMechanismDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MemberMechanismDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MemberMechanismDO::getId));
    }

}
